Motorola's Freeware Assemblers "Version 1.2" Welcome to "Version 1.2" of Motorola's Freeware Assemblers. I've put the version number in quotes because I'm not certain that anyone's been keeping track... I consider the correction and enhancements made by Bruce Olney as Version 1.1, so I'm calling my contribution "Version 1.2". My contribution consists of activation of the END directive, corrected forward reference handling, allowance of long file or path names (MAC users, this may help you), improved handling of multiple source files, improved error detection and reporting (both input code and assembler operation), allowance of a little more leeway in operand syntax, and some miscellaneous changes. This file contains a more detailed listing of the changes mentioned above, as well as some corrections for another file you'll want: ASREF.MAN. ASREF.MAN is the manual for the freeware assemblers. Look for ASREF.ARC, which can be "de- archived" with PKXARC to yield ASREF.MAN. If you're using an IBM PC or compatible and don't want to compile the assemblers yourself, look for FASPC1P2.ARC. It contains the assemblers ready-to-use (compiled with QuickC 2.0 using compact memory model). Hopefully, a generous MAC user will upload an archive of the assemblers compiled for the MAC. I'll take the liberty of suggesting the name FASMA1P2.ARC. The file ASEMBLER.DOC (included in the archive you got this file from) contains a brief rundown on the freeware assemblers for those acquainted with Motorola's other development products. I have edited ASEMBLER.DOC only a little; it does not include much of the information presented here. I have used good 68HCx05 code to test AS5, so it should be nearly bug free. Since most of the code is common to all the assemblers, the others should be in reasonably good shape but are untested. If you discover bugs, please report them on Motorola's Freeware BBS. If you wish to contact me about these assemblers, I may be reached (in order of preference) on Motorola's Freeware BBS (512) 891-3733 the JDR Microdevices BBS (408) 559-0253 or the Radio-Electronics BBS (516) 293-2283 The files AS0.C, AS1.C, AS4.C, AS5.C, AS9.C, and AS11.C are used to compile the assemblers. Each of these files acts as a list of the source files to use for its version of the assemblers. Either copy all of the .C files and all of the .H files to the disk or directory you want to compile on, or copy only the AS*.C file you want and the files mentioned in it to the disk or directory you want to compile on. Then tell your C compiler to compile the AS*.C file; the others will be read in automatically. If you're working on an 80x86 machine (IBM PC or Clone) you should use either the small or compact memory model. The small model provides slightly smaller program size and slightly faster execution, while the compact model provides more space for the assemblers to store data. Thank you to all who have worked on these assemblers before me, and best wishes to all who use them. Just in case any copyright worries should pop up, I hereby release to the public domain this document and all of the changes and I have written into these assemblers. Greg Thoman 1990 July 15 THE END DIRECTIVE Past versions of the assemblers ignored the END directive. Now, END terminates assembly of the current source file without affecting assembly of subsequent source files and lets you specify your program's entry point. The syntax is: [label] END [expression] [;comment] where the brackets indicate optional items and are NOT included in your code. The label follows the same rules as all other labels: it must start in the first column, must begin with a letter, an underscore, or a period, and may contain letters, digits, underscores, periods, and dollar signs. The expression, if used, sets your program's entry point. Thus, it will usually be a program label; however, it can be any valid expression that evaluates to the address you want. Comments following the END directive should start with a semicolon to prevent confusion in case there's no expression to evaluate. The expression evaluator will probably find a comment distasteful. You may use the END directive at the end of each source file in a group, and may use it more than once in the same file (the first END will stop assembly of that file, so the assembler will never see any later ENDs). If the assembler encounters END with an expression more than once you'll get a warning if the expressions evaluate to the same address. If the expressions evaluate to different addresses, you'll get an error. FORWARD REFERENCE HANDLING The assemblers were deleting the forward reference file before attempting to use it. "Version 1.2" deletes the forward reference file after assembly is finished. This may reduce the number of "phasing errors" you run into, but they'll still be around. LONG FILE OR PATH NAMES The assemblers now attempt to use your C compiler's definition of FILENAME_MAX to set the filename buffer size. I believe this is an ANSI item and may not be defined on non-ANSI compilers. If FILENAME_MAX is not defined by your compiler, the assemblers will use their maximum buffer size (512 bytes in "Version 1.2"). Thus, you should be able to use full path names and work among subdirectories. This may help MAC users who have had to run the assemblers from the root "folder" of a floppy drive. Try it out! MULTIPLE SOURCE FILES The assembler now outputs the message " Assembling ", where is the name of the file about to be assembled, as it begins assembly of each file in pass 2. If you are having the assembler create a listing file, these messages will break the listing file up so you can see which source file is which. Warnings and error messages now report the line number within the source file where a problem was found instead of the cumulative line number. This makes error correction easier. The listing, cross reference, and symbol table use the cumulative line number. ERROR DETECTION AND REPORTING Error and warning messages always give the name of the source file where a problem was found. Some error messages are now less cryptic, and error messages always start with "Error". Use of NUL as a character constant now generates an error message. The assemblers now count the number of warnings issued and output it after assembly. Warnings are output on both passes. If you're generating a listing, it will start with a list of warning messages and each suspect line will be accompanied by its warning message. The assemblers now warn of over-length labels and error on over-length mnemonics or directives. Any unrecognized option on the command line is a fatal error, and the assembler will output a list of allowed options. All memory allocation operations are checked for failure. All file operations are checked for failure. OPERAND SYNTAX Character constants are now allowed to have a closing single quote. Thus, 'a and 'a' are the same to the assemblers. The OPT directive now allows multiple options, as described in ASREF.MAN. The assemblers now allow comma-delimited lists to contain whitespace after each comma. Thus, "OPT NOL,C" is the same as "OPT NOL, C". This also works for data initialization and MC6811 register lists. Note that as always, whitespace is NOT allowed in indexed addressing. "LDA DOG,X" is legal, while "LDA DOG, X" is not. Except for AS4 and certain 6809 instructions, the assemblers interpret an operand consisting only of an index register as a request for zero-offset indexed addressing. Thus, "LDA X", "LDA ,X", and "LDA 0,X" all mean to load register A with the value whose address is in the X register. On the 6804 the registers are memory locations, so the comma is required to prevent confusion. On the 6809, pushes and pulls interpret a register alone as that register, not indexed addressing. Arguments to the OPT directive may now be upper case, lower case, or mixed case. The semicolon may be used to start a comment almost anywhere on a line. Unless the semicolon is the first character on the line at least one whitespace character should precede it. The semicolon does NOT act as a comment starter if it can be interpreted as an argument to an FCC directive or if it is immediately preceded by a single quote ( '; is a character constant, not the start of a comment). MISCELLANEOUS Line continuation with the backslash character has apparently never existed in these assemblers. I have not added it. When the assemblers truncate listing of a long data group, they add a note to the listing to tell you. The buffer size in "Version 1.2" is 512 bytes. This will allow lines up to 510 characters (last two bytes are taken up by the line's carriage return and an end-of-string marker). The assemblers will choke on longer lines. When the assemblers encounter "OPT NOC" while listing, they output the cumulative cycle count to that point. The cumulative cycle count is also output after the last source line if cycle counting is still enabled. AS9 allows TFR from a 16 bit register to an 8 bit register, as described in ASREF.MAN. If you want to use the assemblers on an 8 bit machine you ought to change all of the data items declared as "int" to "short" so that they'll still be long enough for various overflow checks to work (unfortunately, this will slow processing). If you use a 32 bit machine and compiler or change some "int" items to "long", you'll get a warning if the entry point specified with END overflows 16 bits. SOME ASREF.MAN CORRECTIONS Page 6: Parentheses are NOT allowed in expressions. Page 10: The "no listing" option is nol, not no, and is the default. Page 14: The contc option continues a previously stopped cycle count and is not listed in ASREF.MAN. Page 20: The predefined constants for register addresses on the 6804 are A, X, & Y, not A, B, & C.